﻿<%@ Page Title="" Language="C#" MasterPageFile="~/user2.master" AutoEventWireup="true" CodeFile="BestBuy.aspx.cs" Inherits="BestBuy" %>
<%@ Import Namespace="MarketOnlineBUS" %>
<%@ Import Namespace="MarketOnlineDTO" %>
<%@ Import Namespace="System.Collections.Generic" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Content" Runat="Server">
<table width="100%" cellpadding="0" cellspacing="0" style="margin-top:15px">


<%
    List<MonAnDTO> listMonAn = new List<MonAnDTO>();
    listMonAn = new MonAnBUS().LayDanhSachMonAn();

    foreach(MonAnDTO monan in listMonAn)
    {
%>
<tr>
    <td width="200px">
        <%
            String img = "<img width='200px' height='200px' src='images/product/MonAn/" + monan.HinhAnh + "' />";
            Response.Write(img);
        %>
    </td>
    
    <td valign="top" style="padding-left:20px;">
        <div class="tieudemonan"><%= monan.TenMonAn %></div>
        <div><%= monan.MoTaMonAn %></div>
        <br />
        <div>Danh sách thành phần dành cho món ăn</div>
        <br />
        <div>
            <%
                //Lấy danh sách thành phần trong món ăn
                List<ThanhPhanDTO> listThanhPhan= new List<ThanhPhanDTO>();
                listThanhPhan = new ThanhPhanBUS().LayDanhSachThanhPhan(monan.MaMonAn);

                if (listThanhPhan != null)
                {

                    foreach (ThanhPhanDTO item in listThanhPhan)
                    {
                        SanPhamDTO sp_dto = new SanPhamDTO();
                        sp_dto = new SanPhamBUS().LaySanPham(item.MaSP);
            %>
            
                <div>
                    <%
                        img = "<img width='30px' height='30px' src='images/product/" + sp_dto.HinhAnh + "' /> " + sp_dto.TenSP;
                        Response.Write(img);
                   %>
                </div>

            <%
                    }
                    
                    
                }
            %>    
                
                
            
        </div>
        <br />
        <div>
            <% 
                String img_mua = "<a href='Cart.aspx?bestbuy="+monan.MaMonAn.ToString()+"'>";
                img_mua = img_mua + "<img src='images/muahang.jpg' />";
                img_mua = img_mua + "</a>";
                
                Response.Write(img_mua);    
            %>
            
        </div>
    </td>
</tr>
<tr>
    <td><br /></td>
</tr>
<tr>
    <td><br /></td>
</tr>
<%
    }
%>
   
</table>
</asp:Content>

